
#ifndef _MAINWINDOW_H_
#define _MAINWINDOW_H_

#include <BXmlNode>
#include <BSonNode>
#include <BStyle>
#include <BLabel>
#include <BMenu>
#include <BButton>
#include <BComboBox>
#include <BScrollBar>
#include <BProgressBar>
#include <BGroupBox>
#include <BLineEdit>
#include <BTextEdit>
#include <BListWidget>
#include <BTableWidget>
#include <BTreeWidget>
#include <BHtmlWidget>
#include <BScrollWidget>

#include <BDateEdit>
#include <BTimeEdit>
#include <BSpinBox>
#include <BFloatSpinBox>
#include <BDoubleSpinBox>
#include <BDoubleSlider>
#include <BRealSpinBox>
#include <BMainWindow>

#include "StyleFormat.h"

using namespace BWE;

class MainWindow : public BMainWindow
{
public:
	MainWindow();
	~MainWindow();

protected:
	BComboBox* createColorBox();
	BTableWidget* createTableWidget();
	BListWidget* createListWidget();
	BTreeItem* createTreeItem(BXmlNode* node);
	BTreeItem* createTreeItem(BSonNode* node);
	bool assignIcon(BTreeItem* item);
	BHtmlWidget* createHtml(const BString& text);

protected:
	void slotColorButtonClicked(BObject* object);
	void slotSpinBoxEditFinished(BObject* object, const BValue& value);
	void slotRealSpinBoxEditFinished(BObject* object, const BValue& value);
	void slotFloatSpinBoxEditFinished(BObject* object, const BValue& value);
	void slotScrollBarScrolling(BObject* object, const BValue& value);
	void slotDoubleSpinBoxEditFinished(BObject* object, const BValue& value);
	void slotDoubleSliderSliding(BObject* object, const BValue& value);
	void slotFileButtonClicked(BObject* object);
	void slotMessageButtonClicked();
	void slotTimeSynchroChecked(BObject* object, const BValue& value);
	void slotDateSynchroChecked(BObject* object, const BValue& value);
	void slotFilePathRightClicked();
	void slotFilePathEditFinished(BObject* object, const BValue& value);
	void slotLoadButtonClicked();

	void slotTableItemDoubleClicked(BTableWidget* tableWidget, const BValue& value);
	void slotListItemSelected(BListWidget* listWidget, const BValue& value);
	void slotItemTextEdited(BObject* object, const BValue& value);
	void slotItemTextEditFocused(BObject* object, const BValue& value);
	void slotPolicyButtonClicked(BObject* object, const BValue& value);
	void slotPolicyMenuTrigger(BObject* object, const BValue& value);

	void slotSheetFileNameEdited();
	void slotChooseSheetFile();
	void slotSaveSheetButtonClicked();
	void slotStyleSheetEditFinished(BObject* object, const BValue& value);
	void slotMainChildrenFramed(BWidget* widget, const BValue& value);

	void slotShortcutTriggered(BObject* object, const BValue& value);

protected:
	virtual void showEvent(const BEvent& event);

private:
	BSpinBox*			_spinBox;
	BRealSpinBox*		_realSpinBox;
	BFloatSpinBox*		_floatSpinBox;
	BScrollBar*			_scrollBar;
	BDoubleSpinBox*		_doubleSpinBox;
	BDoubleSlider*		_doubleSlider;
	BTimeEdit*			_timeEdit;
	BDateEdit*			_dateEdit;

	BComboBox*		_filePathComboBox;
	BButton*		_loadFileButton;
	BTextEdit*		_styleSheetEdit;
	BLineEdit*		_sheetFileNameEdit;
	BButton*		_saveSheetButton;
	BHtmlWidget*	_htmlWidget;
	BTreeWidget*	_treeWidget;
	BTextEdit*		_textEdit;
};

#endif